import { FormSchema } from '/@/components/Form';
import { BasicColumn } from '/@/components/Table';

export const searchFormSchema: FormSchema[] = [
  {
    field: 'name',
    component: 'Input',
    label: '字典名称',
    colProps: {
      span: 8,
    },
  },
  {
    field: 'code',
    component: 'Input',
    label: '字典编号',
    colProps: {
      span: 8,
    },
  },
];

export const dictColumns: BasicColumn[] = [
  {
    title: '字典名称',
    align: 'center',
    dataIndex: 'name',
    width: 150,
  },
  {
    title: '字典编号',
    align: 'center',
    dataIndex: 'code',
    width: 150,
  },
  {
    title: '描述',
    align: 'center',
    dataIndex: 'description',
    width: 300,
  },
  {
    title: '创建日期',
    align: 'center',
    dataIndex: 'createTime',
    width: 200,
  },
];

export const dictFormSchemas: FormSchema[] = [
  {
    field: 'code',
    component: 'Input',
    label: '字典编号',
    required: true,
  },
  {
    field: 'name',
    component: 'Input',
    label: '字典名称',
    required: true,
  },
  {
    field: 'description',
    component: 'InputTextArea',
    label: '描述',
  },
];

export const dictItemColumns: BasicColumn[] = [
  {
    title: '名称',
    align: 'center',
    dataIndex: 'name',
  },
  {
    title: '数据值',
    align: 'center',
    dataIndex: 'itemValue',
  },
  {
    title: '状态',
    align: 'center',
    dataIndex: 'status',
  },
];

export const dictItemSearchFormSchema: FormSchema[] = [
  {
    field: 'name',
    component: 'Input',
    label: '名称',
    colProps: {
      span: 7,
    },
  },
  {
    field: 'status',
    component: 'Select',
    label: '状态',
    colProps: {
      span: 7,
    },
    componentProps: {
      options: [
        { label: '正常', value: 1 },
        { label: '禁用', value: 0 },
      ],
    },
  },
];

export const dictItemFormSchemas: FormSchema[] = [
  {
    field: 'name',
    component: 'Input',
    label: '名称',
    required: true,
  },
  {
    field: 'itemValue',
    component: 'Input',
    label: '数据值',
    required: true,
  },
  {
    field: 'description',
    component: 'InputTextArea',
    label: '描述',
  },
  {
    field: 'sort',
    component: 'InputNumber',
    label: '排序值',
  },
  {
    field: 'status',
    component: 'Switch',
    label: '是否启用',
    componentProps: {
      checkedValue: 1,
      unCheckedValue: 0,
    },
  },
];
